<?php


namespace app\common\model;


use think\Model;

class LiveRoomBanneduserModel extends Model
{
    protected $connection = 'db_live';

    // 禁言原因类型
    const BAN_TYPE = [
        1 => '广告营销诈骗',
        2 => '低俗色情',
        3 => '不实信息',
        4 => '辱骂谩骂',
        5 => '违法有害信息',
        6 => '涉证言论',
        7 => '其他',
        9 => '发言触发风控',
    ];

    public static function getBanTypeText($ban_type)
    {
        return isset(self::BAN_TYPE[$ban_type]) ? self::BAN_TYPE[$ban_type] : '';
    }

    public function user()
    {
        return $this->hasOne('UserModel', 'id', 'uid')->with('profile')->field("id, nick_name, avatar, is_anchor");
    }

    public function mgruser()
    {
        return $this->hasOne('UserModel', 'id', 'mgrid')->field("id, nick_name, avatar, is_anchor");
    }

    public function admin()
    {
        return $this->hasOne(AdminModel::class, 'id', 'admin_id');
    }
}
